<template>
  <div class="page-box">
      <TopNav title="MoreInfoPage.xxxx" show_left="true"></TopNav>
    <div class="bink_card"><h3>{{ $t('MoreInfoPage.ndsfxx') }}</h3>
      <ul class="bink_card_ul">
        <li><h4>{{ $t('MoreInfoPage.zsxm') }}</h4>
          <input v-model="user_data.realname" type="text" placeholder="$t('MoreInfoPage.wsrzsxmqsz')">
        </li>
        <li><h4>QQ</h4>
          <input v-model="user_data.qq" type="text" placeholder="$t('MoreInfoPage.wsr')QQ$t('MoreInfoPage.qsz')"></li>
      </ul>
    </div>
    <button :disabled="loading"  @click="handleClickSave" class="btn">{{ $t('MoreInfoPage.szxx') }}</button>
  </div>
</template>

<script>
import MainNav from "../components/MainNav";
import TopNav from "../components/TopNav";

export default {
  name: 'MoreInfoPage',
    components: {MainNav,TopNav},
    data () {
    return {
        loading:false,
        user:{},
        user_data:{
            realname:'',
            qq: '',
        },
    }
  },
    methods:{
        handleClickSave(){
            this.loading = true;
            let loading = this.$toast.loading();
            this.$axios.post(this.$api_url.save_more_info,
                this.$qs.stringify(this.user_data)
            ).then((res)=>{
                if(res.data.code == 0){
                    this.$toast.success(res.data.msg);
                    this.getData();
                } else{
                    this.$toast.fail(res.data.msg);
                }
            }).catch((err)=>{
                this.$toast.fail(err.message)
            }).then(()=>{
                loading.hide();
                this.loading = false;
            })
        },
        callbackCloseBank(){
            this.showSelectBank = false;
        },
        callbackConfirmBank(e){
            this.user_data.bank_name = e[0];
        },
        getData(){
            this.$axios.get(this.$api_url.user).then((res)=>{
                let data = res.data;
                this.user = data;
                this.user_data.realname  = data.realname;
                this.user_data.qq = data.qq;
            })
        },
        handleClickSelectBank(){
            this.showSelectBank = true;
        },
    },
    mounted() {
      this.getData();
    },
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
  .page-box{
    padding-top:1.5rem;
    padding-bottom: 1rem;
    text-align: left;
  }
  .bink_card h3{
    padding: 0 .16rem;
    background-color: #eee;
    font-size: .36rem;
    line-height: 1rem;
    color: #333;
  }
  .bink_card_ul li{
    background-color: #fff;
    padding: 0 .56rem;
    overflow: hidden;
  }
  .bink_card_ul li h4{
    float: left;
    font-size: .373333rem;
    line-height: 1.173333rem;
    color: #999;
    width: 2.533333rem;
  }
  .bink_card_ul li input{
    float: left;
    width: 6rem;
    font-size: .373333rem;
    line-height: 1.173333rem;
    color: #666;
    outline-style: none;
    border: 0;
  }
  .btn{
    font-size: .426667rem;
    line-height: 1.12rem;
    border-radius: .106667rem;
    background-color: #2f3848;
    color: #fff;
    width: 90%;
    text-align: center;
    display: block;
    margin: 0 auto;
    margin-top: .666667rem;
  }
  .btn:disabled{
    background: #ccc;
  }
</style>
